|
|
|
|
|
|
|
When the Click event is received by the list box, you should always ensure that a valid element is highlighted by checking whether the ListIndex property is set to something other than -1. If you remember, a -1 value in the ListIndex property signifies that nothing is highlighted in the list box. If the user has selected a valid value in the list box, the FormFind() function is called. If this routine returns a True value, the employee highlighted was found in the database, and now the FormShow procedure can be called to load the data for that employee into the appropriate controls. Youll now learn how to build the FormFind() and FormShow() routines. |
|
|
|
|
|
|
|
|
The FormFind() function takes the value from the ItemData() property and uses it to build a SELECT statement that locates the particular employee that matches the value. You need to build a full SELECT statement with all the columns you want to use on the form. You also need to add a WHERE clause with the value in the ItemData() property: |
|
|
|
 |
|
|
|
|
Private Function FormFind() As Boolean
Dim strSQL As String
strSQL = "SELECT lEmp_id, "
strSQL = strSQL & "sFirst_nm , "
strSQL = strSQL & "szLast_nm, "
strSQL = strSQL & "szCity_nm, "
strSQL = strSQL & "szStreet1_ad, "
strSQL = strSQL & "sState_cd, "
strSQL = strSQL & "lState_id, "
strSQL = strSQL & "sZip_cd, "
strSQL = strSQL & "sPhone_no, "
strSQL = strSQL & "szEMail_ad, "
strSQL = strSQL & "sSex_type , "
strSQL = strSQL & "lEmpType_id, "
strSQL = strSQL & "sSSN_tx, "
strSQL = strSQL & "dtBirth_dt, "
strSQL = strSQL & "cSalary_amt, "
strSQL = strSQL & "dtStart_dt, "
strSQL = strSQL & "dtEnd_dt, "
strSQL = strSQL & "boolActive_fl, "
strSQL = strSQL & "boolHealth_fl, " |
|
|
|
|
|